﻿<!DOCTYPE html>
<html lang="en">
<head>
    <title>测试视频</title>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    <style>

        #example {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
        }

    </style>

</head>
<body>
<div id="example"></div>
<script src="../build/three.js"></script>
<script src="./js/renderers/CanvasRenderer.js"></script>
<script src="./js/renderers/Projector.js"></script>
<script src="../build/mxreality.js"></script>
<script>


    window.onload=function () {
        init();
    }
    //var vr=new VR(scene,renderer,container);
    function init() {
        var  scene, renderer;
        var container;
        //renderer = new THREE.WebGLRenderer();
        AVR.debug=true;
        if( !AVR.Broswer.isIE() && AVR.Broswer.webglAvailable() ) {
            renderer = new THREE.WebGLRenderer();
        }else {
            renderer = new THREE.CanvasRenderer();
        }
        renderer.setPixelRatio( window.devicePixelRatio );
        container = document.getElementById('example');
        container.appendChild(renderer.domElement);



        scene = new THREE.Scene();

        var vr=new VR(scene,renderer,container,{"fov":50});

        //vr.playText="<img src='img/play90.png' width='40' height='40'/>";
        vr.vrbox.radius=600;
        if(AVR.isCrossScreen()) {
            vr.effect.separation=1.2;
        }
        vr.loadProgressManager.onLoad=function () {
            //vr.VRObject.getObjectByName("__panoContainer").geometry.applyMatrix(new THREE.Matrix4().makeScale(1.0,0.4,1.0));
            vr.VRObject.getObjectByName("__mxrealityDefault").visible = true;
        }
        //AVR.useGyroscope=false;
        vr.init(function () {

        });

        vr.playPanorama('https://645-20.vod.tv.itc.cn/sohu/v1/TmwGq6IsWDWHyBbIlYSqWX3kmFNx9BEx93ftCw7Xw7ytHrChWoIyYv7r.mp4?k=4rI81Y&p=j9lvzSw3qL1AopvmomrmqLsU0SvioSomhRYAtUxIgYeiwm12ZD6SotxcgMAS0p0cWK&r=TUldziJCtpCmhWB3tSCGhWlvsmCUqpkWtWaizY&q=OpC3hW7IRYodRDvOwmfCyY2sRYWHfJv4lGv4lGvOWBo2ZDvtfhWtZYd4wm4cWhdtY',vr.resType.video);
        vr.video.setAttribute("loop","loop");
        vr.video.crossOrigin="*";


        vr.video.onended=function () {
        }

        window.addEventListener('resize', function () {
            var isHuawei=navigator.userAgent.match(/;\sHUAWEI\s[a-zA-Z0-9\-]+\sBuild\//);
            if (AVR.OS.isWeixin() && !AVR.OS.isiOS() && isHuawei) {
                if (vr.video.getAttribute('x5-video-orientation') == "landscape") {
                    vr.toolBar.toolbar.style.width = document.body.clientWidth + "px";
                } else {
                    vr.toolBar.toolbar.style.width = "100%";
                }
            }
        })

    }


</script>
</body>
</html>
